<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/7/26
 * Time: 18:11
 */

namespace app\common\model;


class NewsCategory extends Base
{
    protected $name = 'news_category';
    // 开启自动写入时间戳字段
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $dateFormat  = 'Y-m-d H:i:s';
    protected $createTime = 'create_time';
    // 追加属性
    protected $append = [
    ];
    const STATUS_ONE = 0;//禁用
    const STATUS_TWO = 1;//正常
    protected static function init()
    {
        self::beforeDelete(function($row){
            model("News")->where('type',$row['id'])->delete();
        });
    }
}